<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActionDispatch::Response</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActionDispatch::Response 
            
                <span class="parent">&lt; 
                    
                    <a href="../Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/actionpack/lib/action_dispatch/http/response_rb.html">actionpack/lib/action_dispatch/http/response.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<p>Represents an HTTP response generated by a controller action. Use it to
retrieve the current state of the response, or customize the response. It
can either represent a real HTTP response (i.e. one that is meant to be
sent back to the web browser) or a <a
href="TestResponse.html">TestResponse</a> (i.e. one that is generated from
integration tests).</p>

<p>Response is mostly a Ruby on Rails framework implementation detail, and
should never be used directly in controllers. Controllers should use the
methods defined in <a
href="../ActionController/Base.html">ActionController::Base</a> instead.
For example, if you want to set the HTTP response’s content MIME type, then
use ActionControllerBase#headers instead of Response#headers.</p>

<p>Nevertheless, integration tests may want to inspect controller responses in
more detail, and that’s when Response can be useful for application
developers. <a href="Integration.html">Integration</a> test methods such as
<a
href="Integration/RequestHelpers.html#method-i-get">ActionDispatch::Integration::RequestHelpers#get</a>
and <a
href="Integration/RequestHelpers.html#method-i-post">ActionDispatch::Integration::RequestHelpers#post</a>
return objects of type <a href="TestResponse.html">TestResponse</a> (which
are of course also of type Response).</p>

<p>For example, the following demo integration test prints the body of the
controller response to the console:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">DemoControllerTest</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActionDispatch</span><span class="ruby-operator">::</span><span class="ruby-constant">IntegrationTest</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">test_print_root_path_to_console</span>
    <span class="ruby-identifier">get</span>(<span class="ruby-string">'/'</span>)
    <span class="ruby-identifier">puts</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

    </div>
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>A</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-await_commit">await_commit</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>B</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-body">body</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-body-3D">body=</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-body_parts">body_parts</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-close">close</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-code">code</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-commit-21">commit!</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-committed-3F">committed?</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-content_type-3D">content_type=</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-cookies">cookies</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-delete_cookie">delete_cookie</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>L</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-location">location</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-location-3D">location=</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>M</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-message">message</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>N</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-c-new">new</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>P</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-prepare-21">prepare!</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>R</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-redirect_url">redirect_url</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-respond_to-3F">respond_to?</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-response_code">response_code</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-set_cookie">set_cookie</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-status-3D">status=</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-status_message">status_message</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Response.html#method-i-to_a">to_a</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-to_ary">to_ary</a>,
              </li>
            
              
              <li>
                <a href="Response.html#method-i-to_path">to_path</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  
    <!-- Includes -->
    <div class="sectiontitle">Included Modules</div>
    <ul>
      
        <li>
          
            Rack::Response::Helpers
          
        </li>
      
        <li>
          
            <a href="Http/FilterRedirect.html">
              ActionDispatch::Http::FilterRedirect
            </a>
          
        </li>
      
        <li>
          
            <a href="Http/Cache/Response.html">
              ActionDispatch::Http::Cache::Response
            </a>
          
        </li>
      
        <li>
          
            MonitorMixin
          
        </li>
      
    </ul>
  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">CONTENT_TYPE</td>
            <td>=</td>
            <td class="attr-value">&quot;Content-Type&quot;.freeze</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">SET_COOKIE</td>
            <td>=</td>
            <td class="attr-value">&quot;Set-Cookie&quot;.freeze</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">LOCATION</td>
            <td>=</td>
            <td class="attr-value">&quot;Location&quot;.freeze</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">NO_CONTENT_CODES</td>
            <td>=</td>
            <td class="attr-value">[204, 304]</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">EMPTY</td>
            <td>=</td>
            <td class="attr-value">&quot; &quot;</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    
      <!-- Section attributes -->
      <div class="sectiontitle">Attributes</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>charset</td>
            <td class='attr-desc'><p>Sets the HTTP response’s content MIME type. For example, in the controller
you could write this:</p>

<pre>response.content_type = &quot;text/plain&quot;</pre>

<p>If a character set has been defined for this response (see charset=) then
the character set information will also be included in the content type
information.</p></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [R]
            </td>
            <td class='attr-name'>content_type</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>header</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>headers=</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>request</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [W]
            </td>
            <td class='attr-name'>sending_file</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [R]
            </td>
            <td class='attr-name'>status</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [R]
            </td>
            <td class='attr-name'>stream</td>
            <td class='attr-desc'></td>
          </tr>
        
      </table>
    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-new">
            
              <b>new</b>(status = 200, header = {}, body = [])
            
            <a href="Response.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L98" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 98</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">status</span> = <span class="ruby-number">200</span>, <span class="ruby-identifier">header</span> = {}, <span class="ruby-identifier">body</span> = [])
  <span class="ruby-keyword">super</span>()

  <span class="ruby-identifier">header</span> = <span class="ruby-identifier">merge_default_headers</span>(<span class="ruby-identifier">header</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">default_headers</span>)

  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">body</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">header</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">body</span>, <span class="ruby-identifier">header</span>, <span class="ruby-identifier">status</span>

  <span class="ruby-ivar">@sending_file</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@blank</span>        = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@cv</span>           = <span class="ruby-identifier">new_cond</span>
  <span class="ruby-ivar">@committed</span>    = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@content_type</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@charset</span>      = <span class="ruby-keyword">nil</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">content_type</span> = <span class="ruby-keyword">self</span>[<span class="ruby-constant">CONTENT_TYPE</span>]
    <span class="ruby-identifier">type</span>, <span class="ruby-identifier">charset</span> = <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/;\s*charset=/</span>)
    <span class="ruby-ivar">@content_type</span> = <span class="ruby-constant">Mime</span><span class="ruby-operator">::</span><span class="ruby-constant">Type</span>.<span class="ruby-identifier">lookup</span>(<span class="ruby-identifier">type</span>)
    <span class="ruby-ivar">@charset</span> = <span class="ruby-identifier">charset</span> <span class="ruby-operator">||</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">default_charset</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">prepare_cache_control!</span>

  <span class="ruby-keyword">yield</span> <span class="ruby-keyword">self</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-await_commit">
            
              <b>await_commit</b>()
            
            <a href="Response.html#method-i-await_commit" name="method-i-await_commit" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-await_commit_source')" id="l_method-i-await_commit_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L123" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-await_commit_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 123</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">await_commit</span>
  <span class="ruby-identifier">synchronize</span> <span class="ruby-keyword">do</span>
    <span class="ruby-ivar">@cv</span>.<span class="ruby-identifier">wait_until</span> { <span class="ruby-ivar">@committed</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-body">
            
              <b>body</b>()
            
            <a href="Response.html#method-i-body" name="method-i-body" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the content of the response as a string. This contains the contents
of any calls to <code>render</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-body_source')" id="l_method-i-body_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L186" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-body_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 186</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">body</span>
  <span class="ruby-identifier">strings</span> = []
  <span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-identifier">strings</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">part</span>.<span class="ruby-identifier">to_s</span> }
  <span class="ruby-identifier">strings</span>.<span class="ruby-identifier">join</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-body-3D">
            
              <b>body=</b>(body)
            
            <a href="Response.html#method-i-body-3D" name="method-i-body-3D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Allows you to manually set or override the response body.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-body-3D_source')" id="l_method-i-body-3D_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L195" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-body-3D_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 195</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">body=</span>(<span class="ruby-identifier">body</span>)
  <span class="ruby-ivar">@blank</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">body</span> <span class="ruby-operator">==</span> <span class="ruby-constant">EMPTY</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_path</span>)
    <span class="ruby-ivar">@stream</span> = <span class="ruby-identifier">body</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@stream</span> = <span class="ruby-identifier">build_buffer</span> <span class="ruby-keyword">self</span>, <span class="ruby-identifier">munge_body_object</span>(<span class="ruby-identifier">body</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-body_parts">
            
              <b>body_parts</b>()
            
            <a href="Response.html#method-i-body_parts" name="method-i-body_parts" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-body_parts_source')" id="l_method-i-body_parts_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L205" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-body_parts_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 205</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">body_parts</span>
  <span class="ruby-identifier">parts</span> = []
  <span class="ruby-ivar">@stream</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">x</span> }
  <span class="ruby-identifier">parts</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-close">
            
              <b>close</b>()
            
            <a href="Response.html#method-i-close" name="method-i-close" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-close_source')" id="l_method-i-close_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L228" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-close_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 228</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">close</span>
  <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:close</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-code">
            
              <b>code</b>()
            
            <a href="Response.html#method-i-code" name="method-i-code" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a string to ensure compatibility with
<code>Net::HTTPResponse</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-code_source')" id="l_method-i-code_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L155" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-code_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 155</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">code</span>
  <span class="ruby-ivar">@status</span>.<span class="ruby-identifier">to_s</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-commit-21">
            
              <b>commit!</b>()
            
            <a href="Response.html#method-i-commit-21" name="method-i-commit-21" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-commit-21_source')" id="l_method-i-commit-21_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L129" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-commit-21_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 129</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">commit!</span>
  <span class="ruby-identifier">synchronize</span> <span class="ruby-keyword">do</span>
    <span class="ruby-ivar">@committed</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-ivar">@cv</span>.<span class="ruby-identifier">broadcast</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-committed-3F">
            
              <b>committed?</b>()
            
            <a href="Response.html#method-i-committed-3F" name="method-i-committed-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-committed-3F_source')" id="l_method-i-committed-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L136" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-committed-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 136</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">committed?</span>
  <span class="ruby-ivar">@committed</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-content_type-3D">
            
              <b>content_type=</b>(content_type)
            
            <a href="Response.html#method-i-content_type-3D" name="method-i-content_type-3D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-content_type-3D_source')" id="l_method-i-content_type-3D_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L145" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-content_type-3D_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 145</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">content_type=</span>(<span class="ruby-identifier">content_type</span>)
  <span class="ruby-ivar">@content_type</span> = <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">to_s</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-cookies">
            
              <b>cookies</b>()
            
            <a href="Response.html#method-i-cookies" name="method-i-cookies" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the response cookies, converted to a <a
href="../Hash.html">Hash</a> of (name =&gt; value) pairs</p>

<pre>assert_equal 'AuthorOfNewPage', r.cookies['author']</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-cookies_source')" id="l_method-i-cookies_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L241" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-cookies_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 241</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">cookies</span>
  <span class="ruby-identifier">cookies</span> = {}
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">header</span> = <span class="ruby-keyword">self</span>[<span class="ruby-constant">SET_COOKIE</span>]
    <span class="ruby-identifier">header</span> = <span class="ruby-identifier">header</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;\n&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">header</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_str</span>)
    <span class="ruby-identifier">header</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cookie</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">pair</span> = <span class="ruby-identifier">cookie</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">';'</span>).<span class="ruby-identifier">first</span>
        <span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span> = <span class="ruby-identifier">pair</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;=&quot;</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">v</span>) }
        <span class="ruby-identifier">cookies</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">cookies</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-delete_cookie">
            
              <b>delete_cookie</b>(key, value={})
            
            <a href="Response.html#method-i-delete_cookie" name="method-i-delete_cookie" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-delete_cookie_source')" id="l_method-i-delete_cookie_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L215" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-delete_cookie_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 215</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">delete_cookie</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>={})
  <span class="ruby-operator">::</span><span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">delete_cookie_header!</span>(<span class="ruby-identifier">header</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-location">
            
              <b>location</b>()
            
            <a href="Response.html#method-i-location" name="method-i-location" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Response.html#method-i-redirect_url">redirect_url</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-location_source')" id="l_method-i-location_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L219" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-location_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 219</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">location</span>
  <span class="ruby-identifier">headers</span>[<span class="ruby-constant">LOCATION</span>]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-location-3D">
            
              <b>location=</b>(url)
            
            <a href="Response.html#method-i-location-3D" name="method-i-location-3D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-location-3D_source')" id="l_method-i-location-3D_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L224" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-location-3D_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 224</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">location=</span>(<span class="ruby-identifier">url</span>)
  <span class="ruby-identifier">headers</span>[<span class="ruby-constant">LOCATION</span>] = <span class="ruby-identifier">url</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-message">
            
              <b>message</b>()
            
            <a href="Response.html#method-i-message" name="method-i-message" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the corresponding message for the current HTTP status code:</p>

<pre class="ruby"><span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-value">200</span>
<span class="ruby-identifier">response</span>.<span class="ruby-identifier">message</span> <span class="ruby-comment"># =&gt; &quot;OK&quot;</span>

<span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-value">404</span>
<span class="ruby-identifier">response</span>.<span class="ruby-identifier">message</span> <span class="ruby-comment"># =&gt; &quot;Not Found&quot;</span>
</pre>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Response.html#method-i-status_message">status_message</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-message_source')" id="l_method-i-message_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L167" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-message_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 167</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">message</span>
  <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_STATUS_CODES</span>[<span class="ruby-ivar">@status</span>]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-prepare-21">
            
              <b>prepare!</b>()
            
            <a href="Response.html#method-i-prepare-21" name="method-i-prepare-21" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-redirect_url">
            
              <b>redirect_url</b>()
            
            <a href="Response.html#method-i-redirect_url" name="method-i-redirect_url" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-respond_to-3F">
            
              <b>respond_to?</b>(method)
            
            <a href="Response.html#method-i-respond_to-3F" name="method-i-respond_to-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-respond_to-3F_source')" id="l_method-i-respond_to-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L172" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-respond_to-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 172</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">respond_to?</span>(<span class="ruby-identifier">method</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-string">'to_path'</span>
    <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_path</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-response_code">
            
              <b>response_code</b>()
            
            <a href="Response.html#method-i-response_code" name="method-i-response_code" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>The response code of the request.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-response_code_source')" id="l_method-i-response_code_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L150" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-response_code_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 150</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">response_code</span>
  <span class="ruby-ivar">@status</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-set_cookie">
            
              <b>set_cookie</b>(key, value)
            
            <a href="Response.html#method-i-set_cookie" name="method-i-set_cookie" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-set_cookie_source')" id="l_method-i-set_cookie_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L211" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-set_cookie_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 211</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">set_cookie</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
  <span class="ruby-operator">::</span><span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">set_cookie_header!</span>(<span class="ruby-identifier">header</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-status-3D">
            
              <b>status=</b>(status)
            
            <a href="Response.html#method-i-status-3D" name="method-i-status-3D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Sets the HTTP status code.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-status-3D_source')" id="l_method-i-status-3D_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L141" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-status-3D_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 141</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">status=</span>(<span class="ruby-identifier">status</span>)
  <span class="ruby-ivar">@status</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">status_code</span>(<span class="ruby-identifier">status</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-status_message">
            
              <b>status_message</b>()
            
            <a href="Response.html#method-i-status_message" name="method-i-status_message" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_a">
            
              <b>to_a</b>()
            
            <a href="Response.html#method-i-to_a" name="method-i-to_a" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Response.html#method-i-prepare-21">prepare!</a>, <a href="Response.html#method-i-to_ary">to_ary</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_a_source')" id="l_method-i-to_a_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L232" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_a_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 232</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_a</span>
  <span class="ruby-identifier">rack_response</span> <span class="ruby-ivar">@status</span>, <span class="ruby-ivar">@header</span>.<span class="ruby-identifier">to_hash</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_ary">
            
              <b>to_ary</b>()
            
            <a href="Response.html#method-i-to_ary" name="method-i-to_ary" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_path">
            
              <b>to_path</b>()
            
            <a href="Response.html#method-i-to_path" name="method-i-to_path" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_path_source')" id="l_method-i-to_path_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5fe68292c2ae46fed868b53fff04396e0f465019/actionpack/lib/action_dispatch/http/response.rb#L180" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_path_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/http/response.rb, line 180</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_path</span>
  <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">to_path</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    